﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zeus.Thunder.Core;

namespace SharpTrainer.Linq
{
    class GroupByTest : ITestCase
    {
        public void Run()
        {
            string[] files = Directory.GetFiles("E:\\MyBook\\RecentRead\\AspMvc");
            IEnumerable<IGrouping<string, string>> query = files.GroupBy(file => Path.GetExtension(file));
            foreach (IGrouping<string, string> grouping in query)
            {
                Console.WriteLine("Extension: " + grouping.Key);
                foreach (string filename in grouping)
                    Console.WriteLine(" - " + filename);
            }
        }
    }
}
